//
//  DayRankCell.m
//  JZRJAPPT
//
//  Created by mac on 16/5/11.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "DayRankCell.h"
@interface DayRankCell ()
@property (weak, nonatomic) IBOutlet UILabel *nameLable;
@property (weak, nonatomic) IBOutlet UILabel *numberLable;

@property (weak, nonatomic) IBOutlet UILabel *zuixinLable;
@property (weak, nonatomic) IBOutlet UILabel *zhangLable;
@property (weak, nonatomic) IBOutlet UILabel *liangLable;
@property (weak, nonatomic) IBOutlet UIView *imageViw;
@property (weak, nonatomic) IBOutlet UILabel *lastLable;

@end
@implementation DayRankCell


-(void)setDayRankModel:(DayRankModel *)dayRankModel{
    _dayRankModel = dayRankModel;
    _nameLable.text = dayRankModel.Name;
    _numberLable.text = dayRankModel.Code;
    _zuixinLable.text = [NSString stringWithFormat:@"%.3f", [dayRankModel.LastPrice floatValue]];
    _zuixinLable.textColor =[UIColor redColor];
    if ([dayRankModel.ChgRate floatValue] > 0) {
        _zhangLable.textColor = [UIColor redColor];
    }
    else{
        _zhangLable.textColor =[UIColor greenColor];
    }
    _zhangLable.text = [NSString stringWithFormat:@"%.2f%@", [dayRankModel.ChgRate floatValue] * 100,@"%"];
    //_zhangLable.text = [dayRankModel.ChgRate stringValue];
    _liangLable.text = [dayRankModel.FinalScore stringValue];
    NSString *str1 = [NSString stringWithFormat:@"%@",_dayRankModel.LHOpinion];
    NSString *str2 = [str1 substringWithRange:NSMakeRange(0, 2)];
    NSLog(@"%@",str2);
    _lastLable.text = str2;
    if ([_lastLable.text isEqualToString:@"空仓"]) {
        _liangLable.textColor = [UIColor cyanColor];
        UIImageView *view = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"out"]];
        view.frame =CGRectMake(0, 2, 15, 15);
        [_imageViw addSubview:view];
        
    }if ([_lastLable.text isEqualToString:@"持仓"]) {
        _liangLable.textColor = [UIColor yellowColor];
        
        UIImageView *view = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"in"]];
        view.frame =CGRectMake(0, 2, 15, 15);
        [_imageViw addSubview:view];
        
    }if ([_lastLable.text isEqualToString:@"建仓"]) {
        _liangLable.textColor = [UIColor redColor];
        UIImageView *view = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"buy"]];
        view.frame =CGRectMake(0, 2, 15, 15);
        [_imageViw addSubview:view];
    }if ([_lastLable.text isEqualToString:@"卖出"]) {
        _liangLable.textColor = [UIColor greenColor];
        UIImageView *view = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"sold"]];
        view.frame =CGRectMake(0, 2, 15, 15);
        [_imageViw addSubview:view];
    }

    
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
